package com.hziee.graduate.ticket.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hziee.graduate.ticket.dto.R;
import com.hziee.graduate.ticket.entity.CinemaMovie;
import com.hziee.graduate.ticket.entity.Movie;
import com.hziee.graduate.ticket.service.CinemaMovieService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

/**
 * (CinemaMovie)表控制层
 *
 * @author makejava
 * @since 2022-10-01 22:58:51
 */
@RestController
@RequestMapping("cinemaMovie")
public class CinemaMovieController {
    @Resource
    private CinemaMovieService cinemaMovieService;

    @GetMapping("/getAllMovieByCinema/{cinemaId}")
    public R<List<Movie>> getAllMovieByCinema(@PathVariable("cinemaId") Long cinemaId) {
        return cinemaMovieService.getAllMovieByCinema(cinemaId);
    }

    @GetMapping("/getUnJoinMovieByCinema/{cinemaId}")
    public R<List<Movie>> getUnJoinMovieByCinema(@PathVariable("cinemaId") Long cinemaId) {
        return cinemaMovieService.getUnJoinMovieByCinema(cinemaId);
    }

    @GetMapping("/addCinemaMovie/{cinemaId}/{movieId}/{userId}")
    public R<Object> addCinemaMovie(
            @PathVariable("cinemaId") Long cinemaId,
            @PathVariable("movieId") Long movieId,
            @PathVariable("userId") Long userId
    ) {
        return cinemaMovieService.addCinemaMovie(cinemaId,movieId,userId);
    }

    @GetMapping("/delCinemaMovie/{cinemaId}/{movieId}")
    public R<Object> addCinemaMovie(@PathVariable("cinemaId") Long cinemaId, @PathVariable("movieId") Long movieId ) {
        return cinemaMovieService.delCinemaMovie(cinemaId,movieId);
    }
}

